package de.graffiti.paint;

import java.awt.Image;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;

public class ImageInfo
{

	private int wallpaperid;
	private String sessionid;
	private int height;
	private int width;
	private boolean repeating;
	private int contentid;

	Image picture = null;

	public ImageInfo(int wallpaperid, int contentid, int width, int height, String sessionid, boolean repeating)
	{
		this.wallpaperid = wallpaperid;
		this.contentid = contentid;
		this.width = width;
		this.height = height;
		this.sessionid = sessionid;
		this.repeating = repeating;
	}

	public void loadImage() throws IOException
	{

		// Read from a URL
		URL url = new URL("http://localhost:8080/graffitiWeb/ContentServlet?contentid=" + contentid + "&sessionid=" + sessionid);
		picture = ImageIO.read(url);
	}

	public int getWallpaperid()
	{
		return wallpaperid;
	}

	public void setWallpaperid(int wallpaperid)
	{
		this.wallpaperid = wallpaperid;
	}

	public String getSessionid()
	{
		return sessionid;
	}

	public void setSessionid(String sessionid)
	{
		this.sessionid = sessionid;
	}

	public int getHeight()
	{
		return height;
	}

	public void setHeight(int height)
	{
		this.height = height;
	}

	public int getWidth()
	{
		return width;
	}

	public void setWidth(int width)
	{
		this.width = width;
	}

	public boolean isRepeating()
	{
		return repeating;
	}

	public void setRepeating(boolean repeating)
	{
		this.repeating = repeating;
	}

	public Image getPicture()
	{
		return picture;
	}

	public void setPicture(Image picture)
	{
		this.picture = picture;
	}

	public int getContentid()
	{
		return contentid;
	}

	public void setContentid(int contentid)
	{
		this.contentid = contentid;
	}

}
